/*
 * SelectedNodes.java
 * 
 * Created by demory on Jul 12, 2008, 8:56:01 PM
 * 
 * Copyright 2008 David D. Emory
 * 
 * This file is part of Five Points. See <http://www.fpdev.org> for
 * additional information regarding the project.
 * 
 * Five Points is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Five Points is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Five Points.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.fpdev.apps.rtemaster.gui.map;

import java.awt.Color;
import java.util.HashSet;
import java.util.Iterator;
import org.fpdev.core.basenet.BNode;

/**
 * Collection of currently selected nodes in the MapPanel.
 * 
 * @author demory
 */
public class SelectedNodes extends HashSet<BNode> {
  
  private boolean visible_;
  
  public SelectedNodes() {
    super();
    visible_ = false;
  }
  
  public boolean isVisible() {
    return visible_;
  }
  
  public void setVisible(boolean v) {
    visible_ = v;
  }
  
  public void addFromIterator(Iterator<BNode> nodes) {
    while (nodes.hasNext()) add(nodes.next());
  }

  public void draw(MapCanvas canvas) {
    canvas.setColor(Color.yellow);
    for (Iterator<BNode> nodes = iterator(); nodes.hasNext();) {
      BNode node = nodes.next();
      node.drawSel(canvas);
    }
  }

}
